/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Adam
 */
@Entity
@Table(name = "routes")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Routes.findAll", query = "SELECT r FROM Routes r"),
    @NamedQuery(name = "Routes.findByRouteId", query = "SELECT r FROM Routes r WHERE r.routeId = :routeId"),
    @NamedQuery(name = "Routes.findByAdded", query = "SELECT r FROM Routes r WHERE r.added = :added"),
    @NamedQuery(name = "Routes.findByKilometres", query = "SELECT r FROM Routes r WHERE r.kilometres = :kilometres"),
    @NamedQuery(name = "Routes.findByAvgSpeed", query = "SELECT r FROM Routes r WHERE r.avgSpeed = :avgSpeed"),
    @NamedQuery(name = "Routes.findByTimeDriven", query = "SELECT r FROM Routes r WHERE r.timeDriven = :timeDriven"),
    @NamedQuery(name = "Routes.findBySLatitude", query = "SELECT r FROM Routes r WHERE r.sLatitude = :sLatitude"),
    @NamedQuery(name = "Routes.findBySLongitude", query = "SELECT r FROM Routes r WHERE r.sLongitude = :sLongitude"),
    @NamedQuery(name = "Routes.findByELatitude", query = "SELECT r FROM Routes r WHERE r.eLatitude = :eLatitude"),
    @NamedQuery(name = "Routes.findByELongitude", query = "SELECT r FROM Routes r WHERE r.eLongitude = :eLongitude"),
    @NamedQuery(name = "Routes.findBySStreet", query = "SELECT r FROM Routes r WHERE r.sStreet = :sStreet"),
    @NamedQuery(name = "Routes.findBySCity", query = "SELECT r FROM Routes r WHERE r.sCity = :sCity"),
    @NamedQuery(name = "Routes.findBySState", query = "SELECT r FROM Routes r WHERE r.sState = :sState"),
    @NamedQuery(name = "Routes.findByEStreet", query = "SELECT r FROM Routes r WHERE r.eStreet = :eStreet"),
    @NamedQuery(name = "Routes.findByECity", query = "SELECT r FROM Routes r WHERE r.eCity = :eCity"),
    @NamedQuery(name = "Routes.findByEState", query = "SELECT r FROM Routes r WHERE r.eState = :eState"),
    @NamedQuery(name = "Routes.findByNPolice", query = "SELECT r FROM Routes r WHERE r.nPolice = :nPolice"),
    @NamedQuery(name = "Routes.findByNPatrol", query = "SELECT r FROM Routes r WHERE r.nPatrol = :nPatrol"),
    @NamedQuery(name = "Routes.findByNAccident", query = "SELECT r FROM Routes r WHERE r.nAccident = :nAccident"),
    @NamedQuery(name = "Routes.findByNMobileradar", query = "SELECT r FROM Routes r WHERE r.nMobileradar = :nMobileradar")})
public class Routes implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "route_id")
    private Integer routeId;
    @Basic(optional = false)
    @NotNull
    @Column(name = "added")
    @Temporal(TemporalType.TIMESTAMP)
    private Date added;
    @Basic(optional = false)
    @NotNull
    @Column(name = "kilometres")
    private int kilometres;
    @Basic(optional = false)
    @NotNull
    @Column(name = "avg_speed")
    private int avgSpeed;
    @Basic(optional = false)
    @NotNull
    @Column(name = "time_driven")
    private int timeDriven;
    @Basic(optional = false)
    @NotNull
    @Column(name = "s_latitude")
    private double sLatitude;
    @Basic(optional = false)
    @NotNull
    @Column(name = "s_longitude")
    private double sLongitude;
    @Basic(optional = false)
    @NotNull
    @Column(name = "e_latitude")
    private double eLatitude;
    @Basic(optional = false)
    @NotNull
    @Column(name = "e_longitude")
    private double eLongitude;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "s_street")
    private String sStreet;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "s_city")
    private String sCity;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 60)
    @Column(name = "s_state")
    private String sState;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "e_street")
    private String eStreet;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "e_city")
    private String eCity;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 60)
    @Column(name = "e_state")
    private String eState;
    @Basic(optional = false)
    @NotNull
    @Column(name = "n_police")
    private int nPolice;
    @Basic(optional = false)
    @NotNull
    @Column(name = "n_patrol")
    private int nPatrol;
    @Basic(optional = false)
    @NotNull
    @Column(name = "n_accident")
    private int nAccident;
    @Basic(optional = false)
    @NotNull
    @Column(name = "n_mobileradar")
    private int nMobileradar;
    @JoinColumn(name = "user_id", referencedColumnName = "user_id")
    @ManyToOne(optional = false)
    private Users userId;

    public Routes() {
    }

    public Routes(Integer routeId) {
        this.routeId = routeId;
    }

    public Routes(Integer routeId, Date added, int kilometres, int avgSpeed, int timeDriven, double sLatitude, double sLongitude, double eLatitude, double eLongitude, String sStreet, String sCity, String sState, String eStreet, String eCity, String eState, int nPolice, int nPatrol, int nAccident, int nMobileradar) {
        this.routeId = routeId;
        this.added = added;
        this.kilometres = kilometres;
        this.avgSpeed = avgSpeed;
        this.timeDriven = timeDriven;
        this.sLatitude = sLatitude;
        this.sLongitude = sLongitude;
        this.eLatitude = eLatitude;
        this.eLongitude = eLongitude;
        this.sStreet = sStreet;
        this.sCity = sCity;
        this.sState = sState;
        this.eStreet = eStreet;
        this.eCity = eCity;
        this.eState = eState;
        this.nPolice = nPolice;
        this.nPatrol = nPatrol;
        this.nAccident = nAccident;
        this.nMobileradar = nMobileradar;
    }

    public Integer getRouteId() {
        return routeId;
    }

    public void setRouteId(Integer routeId) {
        this.routeId = routeId;
    }

    public Date getAdded() {
        return added;
    }

    public void setAdded(Date added) {
        this.added = added;
    }

    public int getKilometres() {
        return kilometres;
    }

    public void setKilometres(int kilometres) {
        this.kilometres = kilometres;
    }

    public int getAvgSpeed() {
        return avgSpeed;
    }

    public void setAvgSpeed(int avgSpeed) {
        this.avgSpeed = avgSpeed;
    }

    public int getTimeDriven() {
        return timeDriven;
    }

    public void setTimeDriven(int timeDriven) {
        this.timeDriven = timeDriven;
    }

    public double getSLatitude() {
        return sLatitude;
    }

    public void setSLatitude(double sLatitude) {
        this.sLatitude = sLatitude;
    }

    public double getSLongitude() {
        return sLongitude;
    }

    public void setSLongitude(double sLongitude) {
        this.sLongitude = sLongitude;
    }

    public double getELatitude() {
        return eLatitude;
    }

    public void setELatitude(double eLatitude) {
        this.eLatitude = eLatitude;
    }

    public double getELongitude() {
        return eLongitude;
    }

    public void setELongitude(double eLongitude) {
        this.eLongitude = eLongitude;
    }

    public String getSStreet() {
        return sStreet;
    }

    public void setSStreet(String sStreet) {
        this.sStreet = sStreet;
    }

    public String getSCity() {
        return sCity;
    }

    public void setSCity(String sCity) {
        this.sCity = sCity;
    }

    public String getSState() {
        return sState;
    }

    public void setSState(String sState) {
        this.sState = sState;
    }

    public String getEStreet() {
        return eStreet;
    }

    public void setEStreet(String eStreet) {
        this.eStreet = eStreet;
    }

    public String getECity() {
        return eCity;
    }

    public void setECity(String eCity) {
        this.eCity = eCity;
    }

    public String getEState() {
        return eState;
    }

    public void setEState(String eState) {
        this.eState = eState;
    }

    public int getNPolice() {
        return nPolice;
    }

    public void setNPolice(int nPolice) {
        this.nPolice = nPolice;
    }

    public int getNPatrol() {
        return nPatrol;
    }

    public void setNPatrol(int nPatrol) {
        this.nPatrol = nPatrol;
    }

    public int getNAccident() {
        return nAccident;
    }

    public void setNAccident(int nAccident) {
        this.nAccident = nAccident;
    }

    public int getNMobileradar() {
        return nMobileradar;
    }

    public void setNMobileradar(int nMobileradar) {
        this.nMobileradar = nMobileradar;
    }

    public Users getUserId() {
        return userId;
    }

    public void setUserId(Users userId) {
        this.userId = userId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (routeId != null ? routeId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Routes)) {
            return false;
        }
        Routes other = (Routes) object;
        if ((this.routeId == null && other.routeId != null) || (this.routeId != null && !this.routeId.equals(other.routeId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.Routes[ routeId=" + routeId + " ]";
    }
    
}
